<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiFlowCategoryStepTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_flow_category_step';

    /**
     * Run the migrations.
     * @table qii_flow_category_step
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id')->comment('STEP ID');
            $table->unsignedInteger('category_id')->default('0')->comment('工作流模型ID');
            $table->string('name', 60)->default('')->comment('步骤名称');
            $table->string('key', 20)->default('')->comment('步骤标识');
            $table->unsignedInteger('sortrank')->default('0')->comment('步骤顺序');
            $table->text('examine_user_id')->comment('步骤审核人员uid,多个用逗号分隔');
            $table->text('examine_role_id')->comment('步骤审核人员角色id,多个角色用逗号分隔');
            $table->unsignedSmallInteger('examine_rule')->default('0')->comment('步骤审核规则');

            $table->unique(["key"], 'ikey');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
